﻿using System;
using System.IO;
using System.Text.RegularExpressions;

class Program
{
    static void Main()
    {
        using (StreamReader reader = new StreamReader("index.html"))
        {
            using (StreamWriter writer = new StreamWriter("new-index.html"))
            {
                string text = reader.ReadToEnd();
                //Console.WriteLine(text);
                string patten = @"\<a href=(?<url>[^\>]+)\>(?<content>(.|\s)*?)\</a\>";
                string replacePattern = "[url href=${url}]${content}[/url]";
                string newText = Regex.Replace(text, patten, replacePattern);
                //Console.WriteLine("-----------------------------------------");
                writer.WriteLine(newText);
            }
        }
    }
}

